import logging

from flask import Flask

from api.service.rule_sync_service import reload_rule
from api.service.similar_index_sync_service import sync_data

logger = logging.getLogger(__name__)


def init_app(app: Flask):
    with app.app_context():
        logging.info("Reloading rules...")
        reload_rule()
        sync_data()
        logging.info("Rules reloaded.")
